package com.example.cet4try.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.Button;

import com.example.cet4try.AssetsDatabaseManager;
import com.example.cet4try.R;
import com.example.cet4try.activity.Main2Activity;

public class MainActivity extends AppCompatActivity {

    boolean isstar = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //初始化数据库
        AssetsDatabaseManager.initManager(getApplicationContext());

        new Handler(new Handler.Callback() {
            @Override
            public boolean handleMessage(Message msg) {
                //实现页面跳转
                if (!isstar){
                    startActivity(new Intent(getApplicationContext(),ActivityLogin.class));
                    finish();
                }
                return false;
            }
        }).sendEmptyMessageDelayed(0,3000);//表示延迟3秒发送任务


    }

    @Override
    public void onBackPressed(){
        //Toast.makeText(FileBrowserActivity.this,"返回",Toast.LENGTH_SHORT).show();
        startActivity(new Intent(getApplicationContext(), ActivityLogin.class));
        isstar = true;
        finish();
    }

}
